import styled from 'styled-components'

interface IBarOperator {
  playMode: number
}

interface PlayingProp {
  playing: boolean
}

interface LockProp {
  locked: boolean
}

export const PlayerBarWrapper = styled.div`
  position: fixed;
  z-index: 99;
  left: 0;
  right: 0;
  bottom: 0;
  height: 52px;
  background-position: 0 0;
  background-repeat: repeat;
  transition: all 0.5s ease;

  .content {
    display: flex;
    align-items: center;
    justify-content: space-evenly;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 0;
    height: 47px;
  }
`
export const BarControl = styled.div<PlayingProp>`
  display: flex;
  align-items: center;
  .btn {
    cursor: pointer;
  }
  .prev,
  .next {
    width: 28px;
    height: 28px;
    &:hover {
      background-position: -110px -130px;
    }
  }
  .prev {
    background-position: 0 -130px;
    &:hover {
      background-position: -30px -130px;
    }
  }

  .pause {
    width: 36px;
    height: 36px;
    margin: 0 8px;
    background-position: ${(props) => {
      return props.playing ? '0 -165px' : '0 -204px'
    }};
    &:hover {
      background-position: ${(props) => {
        return props.playing ? '-40px -165px' : '-40px -204px'
      }};
    }
  }

  .next {
    background-position: -80px -130px;
  }
`
export const BarPlayerInfo = styled.div`
  display: flex;
  align-items: center;

  .default-pic {
    border-radius: 5px;
    background-position: 0 -80px;
    overflow: hidden;
    width: 34px;
    height: 34px;
    position: relative;
    .image {
      width: 100%;
      height: 100%;
      position: absolute;
      z-index: -1;
    }
  }

  .info {
    flex: 1;
    color: #a1a1a1;
    margin-left: 10px;
    .song {
      height: 19px;
      color: #fff;
      position: relative;
      top: 8px;
      left: 5px;
      overflow: hidden;
      .song-name {
        cursor: pointer;
        &:hover {
          text-decoration: underline;
        }
      }
      .singer-name {
        position: absolute;
        color: #a1a1a1;
        margin-left: 10px;
        cursor: pointer;
        ${(props) => props.theme.mixin.textNoWrap}
        &:hover {
          text-decoration: underline;
        }
      }
    }

    .progress {
      display: flex;
      align-items: center;

      .ant-slider {
        position: relative;
        top: -2px;
        width: 490px;
        margin-right: 12px;

        .ant-slider-rail {
          height: 9px;
          background: url(${require('@/assets/img/progress_bar.png')}) right 0;
        }
        .ant-slider-step {
          position: absolute;
          left: 0;
          width: 0px;
          height: 9px;
          border-radius: 2px;
          background: url(${require('@/assets/img/progress_bar.png')}) right -30px;
        }
        .ant-slider-track {
          position: absolute;
          z-index: 1;
          height: 9px;
          background: url(${require('@/assets/img/progress_bar.png')}) left -66px;
        }
        .ant-slider-handle {
          position: absolute;
          z-index: 2;
          width: 22px;
          height: 24px;
          border: none;
          margin-top: -7px;
          background: url(${require('@/assets/img/sprite_icon.png')}) 0 -250px;
          &:hover {
            background-position: 0 -280px;
          }
        }
      }
      .time {
        .current {
          color: #e1e1e1;
        }
        .divider {
          margin: 0 3px;
        }
      }
    }
  }
`
export const BarOperator = styled.div<IBarOperator>`
  display: flex;
  align-items: center;
  posititon: relative;
  top: 3px;
  .btn {
    width: 25px;
    height: 25px;
    cursor: pointer;
  }
  .left {
    display: flex;
    align-items: center;
  }
  .pip {
    background-position: -147px -238px;
    margin-top: -14px;
    margin-right: -28px;
  }
  .favor {
    background-position: -88px -163px;
    &:hover {
      background-position: -88px -189px;
    }
  }
  .share {
    background-position: -114px -163px;
    &:hover {
      background-position: -114px -189px;
    }
  }
  .right {
    display: flex;
    align-items: center;
    width: 126px;
    padding-left: 13px;
    position: relative;
    background-position: -147px -248px;
    .volume {
      background-position: -2px -248px;
      &:hover {
        background-position: -31px -248px;
      }
    }
    .novolume {
      background-position: -104px -69px;
      &:hover {
        background-position: -126px -69px;
      }
    }
    .volume-slider {
      width: 32px;
      height: 113px;
      position: absolute;
      left: 8px;
      top: -123px;
      padding: 14px 0 8px 0;
      overflow: hidden;
      background-color: rgb(20, 20, 20);
      .ant-slider-vertical {
        padding: 0;
        margin: 0;
        .ant-slider-rail {
          position: absolute;
          left: 15px;
          width: 4px;
          background-color: rgb(4, 4, 4);
        }
        .ant-slider-track {
          position: absolute;
          left: 15px;
          width: 4px;
          background: rgb(199, 12, 12);
        }
        .ant-slider-step {
          display: none;
        }
        .ant-slider-handle {
          position: absolute;
          left: 13px;
          z-index: 2;
          width: 18px;
          height: 20px;
          border: none;
          background: url(${require('@/assets/img/sprite_icon.png')}) -40px -250px;
          &:hover {
            background-position: -40px -280px;
          }
        }
      }
    }
    .volume-hide {
      display: none;
    }
    .loop {
      background-position: ${(props) => {
        switch (props.playMode) {
          case 1:
            return '-66px -248px'
          case 2:
            return '-66px -344px'
          default:
            return '-3px -344px'
        }
      }};
      &:hover {
        background-position: ${(props) => {
          switch (props.playMode) {
            case 1:
              return '-93px -248px'
            case 2:
              return '-93px -344px'
            default:
              return '-33px -344px'
          }
        }};
      }
    }
    .playlist {
      width: 54px;
      padding-left: 18px;
      text-align: center;
      color: #ccc;
      background-position: -42px -68px;
      &:hover {
        background-position: -42px -98px;
        text-decoration: none;
      }
    }
  }
`
export const BarPlayerLock = styled.div<LockProp>`
  position: absolute;
  top: -14px;
  right: 15px;
  z-index: 100;
  width: 52px;
  height: 67px;
  background-position: 0 -380px;
  .lock-btn {
    width: 18px;
    height: 18px;
    margin: 6px 0 0 17px;
    background-position: ${(props) => {
      return props.locked ? '-100px -380px' : '-80px -380px'
    }};
    &:hover {
      background-position: ${(props) => {
        return props.locked ? '-100px -400px' : '-80px -400px'
      }};
    }
  }
`
export const BarPlayerBlank = styled.div`
  position: absolute;
  z-index: 0;
  bottom: 0;
  right: 15px;
  width: 52px;
  height: 60px;
  border-top-left-radius: 22px;
  border-top-right-radius: 26px;
  background: #f5f5f5;
`
